/**
 * 
 */
package ufpr.mestrado.ais.util;

import java.util.Comparator;
import java.util.logging.Level;

import jmetal.util.Configuration;
import ufpr.mestrado.ais.base.VISSolution;

/**
 * @author gabriel
 * 
 */
public class ParentComparator implements Comparator {

	@Override
	public int compare(Object o1, Object o2) {

		try {
			VISSolution solution1, solution2;

			solution1 = (VISSolution) o1;

			solution2 = (VISSolution) o2;

			if (solution1.getIdParent() < solution2.getIdParent())
				return -1;
			else if (solution1.getIdParent() > solution2.getIdParent())
				return 1;

		} catch (Exception e) {
			Configuration.logger_.log(Level.SEVERE,
					"ParentComparator.compare: JMException ", e);
		}
		return 0;

	}
}
